//index.js
//获取应用实例
var valid1=require('../../../utils/valid')
var app = getApp()
Page({
  data: {
    goods_id:'',
    currentPage:1,
    data:'',
    
  },
  onLoad: function(options) {
    //Do some initialize when page load.
    var that = this;
    let goods_id = options.goods_id;

    wx.request({ 
      url: app.url+'?controller=api_comment&action=index',
      data: {
         goods_id:goods_id,
        page: that.data.currentPage,
      },
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
       header: {'content-type': 'application/json',}, // 设置请求的 header
      success: function(res){
        // success
        console.log(res);
        var data = res.data.data.comment;

        that.setData({
          data:data,
          start:res.data.data.avg_point,
        })
      },
    })
  },
  onReady: function() {
    //Do some when page ready.
    
  },
  onShow: function() {
    //Do some when page show.
    
  },
  onHide: function() {
    //Do some when page hide.
    
  },
  onUnload: function() {
    //Do some when page unload.
    
  },
  onPullDownRefresh: function() {
    //Do some when page pull down.
    
  }
})